package cn.wx.common.persistence.web;

/**
 * @author zj
 * @description : restful 接口返回封装
 * ---------------------------------
 * @since 2017-10-27
 */
public class ResponseData {

    private String code;// 状态码
    private String msg;//状态信息
    private Object data;// 具体内容

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }


    public static ResponseData SUCCESS(String msg, Object data) {
        ResponseData responseData = new ResponseData();
        responseData.msg = msg;
        responseData.data = data;
        responseData.code = ResponseCode.SUCCESS;
        return responseData;
    }

    public static ResponseData ERROR(String code, String msg,Object data) {
        ResponseData responseData = new ResponseData();
        responseData.msg = msg;
        responseData.data = data;
        responseData.code = code;
        return responseData;
    }
}
